This document describes the replication files associated with the paper:
Tomoki Kaneko, Taka-aki Asano, and Hirofumi Miwa. “Estimating Ideal Points of Newspapers from Editorial Texts.” International Journal of Press/Politics.

The following files are contained herein:
Study1_Wordfish_analysis.R (R code to replicate Study 1 (Table 1 and Figure 1))
Study2_1_structural_topic_models.R (R code to replicate the estimation of the structural topic model in Study 2 (Table 1 and Figures A.1 and A.2))
Study2_2_Wordfish_analysis.R (R code to replicate the estimation of the Wordfish model in Study 2)
Study2_3_factor_analysis.R (R code to replicate the estimation of the Bayesian factor analysis model in Study 2)
Study2_4_summary.R (R code to replicate Tables 2, 3, and A.1 and Figures 2, A.3, and A.4)
selective_exposure_paper.R (R code to replicate the study of selective paper-based exposure (Figure 3(a)))
selective_exposure_Twitter.R (R code to replicate the study of the selective following to Twitter accounts (Figures 3(b) and 4))
G_validity_check.R (R code to summarize the quantitative results of previous studies (Table A.2))
I_1_varying_the_number_of_topics.R (R code to replicate a robustness check where we vary the number of topics (Figure A.5))
I_2_one_topic_to_one_editorial.R (R code to replicate a robustness check where we assign one topic to one editorial (Figure A.6))
I_3_multidimensional_factor_analysis.R (R code to replicate the robustness check using multidimensional factor analysis (Table A.3 and Figures A.7 and A.8))
L_1_US_structural_topic_models.R (R code to replicate the estimation of the structural topic model using the data of U.S. newspapers (Table A.7 and Figure A.9)
L_2_US_Wordshoal_analysis.R (R code to replicate the Wordshoal analysis using the data of U.S. newspapers (Figure A.10))
M_gatekeeping_bias.R (R code to replicate the analysis of gatekeeping bias (Table A.8 and Figures A.11 and A.12)) 
factor_analysis_JAGS_preliminary.R (JAGS code for the preliminary estimation of the Bayesian factor analysis model)
factor_analysis_JAGS.R (JAGS code for the estimation of the Bayesian factor analysis model)
Study1_dfm.Rdata (a document-feature matrix used in Study 1)
Study2_dfm.Rdata (a document-feature matrix used in Study 2)
STM_result_65.Rdata (estimation results of the 65-topic structural topic model in Study 2)
Study2_Wordfish_result.Rdata (estimation results of the Wordfish model in Study 2)
FA_result.Rdata (estimation results of the Bayesian factor analysis model in Study 2)
follower_followee_matrix.Rdata (anonymous data of the follower-followee relationship between Diet members and politically active Twitter users)
newspaper_follower_anonymous_id.Rdata (anonymous data of the followers of newspapers’ Twitter accounts)
emIRT_fit.Rdata (estimation results of the network ideal point model in the study of selective following to Twitter accounts)
multidimensional_FA_results.Rdata (estimation results of the multidimensional factor analysis model in the third robustness check)
US_dfm.Rdata (a document-feature matrix used in the analysis of U.S. newspapers)
gatekeeping_FA_results.Rdata (estimation results of the multidimensional factor analysis model in the analysis of gatekeeping bias)
humancoded_positions.csv (data of human-coded newspapers’ positions used in Study 1)
voter2017_IJPP.csv (survey data used to estimate newspaper readers’ ideal points in the study of selective paper-based exposure)
MP_list.csv (list of the Twitter accounts of Diet members used in the study of the selective following to Twitter accounts)
previous_studies.csv (quantitative results of previous studies summarized in Table A.2)
survey19_abridged.csv (online survey data summarized in Table A.2)

Instructions:
1. Put all the files in your working directory.
2. Run the replication codes. Most replication codes work independently from other replication codes. The exceptions are as follows:
- I_1_varying_the_number_of_topics.R requires Rdata files named STM_result_X, which are made by Study2_1_structural_topic_models.R.
- L_2_US_Wordshoal_analysis.R requires Rdata files named US_STM_result_X, which are made by L_1_US_structural_topic_models.R.

Please open Study1_Wordfish_analysis.R with UTF-8. This file contains Japanese characters and will get garbled when opened with another encoding.

All data analyses using these replication files were carried out using R version 3.6.2 and JAGS 4.3.0 as well as the following R packages:  coda version 0.19-3, emIRT version 0.0.11, fanc version 2.2, label.switching version 1.8, ltm version 1.1-1, Matrix version 1.2-18, psych version 1.9.12.31, quanteda version 1.5.2, RColorBrewer version 1.1-2, readr version 1.3.1, runjags version 2.0.4-6, stm version 1.3.5, and stringi version 1.4.6.

If you have any questions or concerns with the files, please feel free to contact the authors.